<?php

class MenuService extends Model {

    /**
     * @var MenuDao
     */
    private $menuDao;

    public function injectDependencies() {
        $this->menuDao = MenuDao::getInstance();
    }

    public function buildMenuFromLoggedUser($IDPerfil) {
        $MainMenu = $this->menuDao->findAllAbleMenu($IDPerfil);
        $ArSubmenus = $this->menuDao->findAllMenuAndSubmenuByProfile($IDPerfil);
        foreach( $ArSubmenus as $Submenu ) {
            $MainMenu->addSubmenu( $Submenu );
        }
        return $MainMenu;
    }

}

?>

